package com.wc.alorithm_blue_bridge._模拟.残缺的数字;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/5/22 23:35
 * @description https://www.lanqiao.cn/problems/17114/learning/?problem_list_id=32&page=1
 */
public class Main {
    static String[] nums = new String[]{
            "1111110",
            "0110000",
            "1101101",
            "1111001",
            "0110011",
            "1011011",
            "1011111",
            "1110000",
            "1111111",
            "1111011"
    };
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long res = 1;
        for (int i = 1; i <= 18; i++) {
            String s = sc.next();
            int cur = 0;
            for (int j = 0; j <= 9; j++) {
                cur += check(s.toCharArray(), nums[j].toCharArray());
            }
            res *= cur;
        }
        System.out.println(res);
    }

    static int check(char[] a, char[] b) {
        for (int i = 0; i < 7; i++) {
            if (a[i] == '1' && b[i] != '1') return 0;
        }
        return 1;
    }
}
